<%@page contentType="text/html;charset=utf-8" %>
<%@taglib prefix="s" uri="/struts-tags" %> 
<script type="text/javascript">

function account_password_save()
{
    var old_password = document.getElementById("old_password").value;
    var new_password = document.getElementById("new_password").value;
    var confirm_password = document.getElementById("confirm_password").value;
     
    if (old_password == null || old_password == "" 
        || new_password == null || new_password == ""
        || confirm_password == null || confirm_password == "")
    {
        alert("信息不完整！");
        return false;
    }

    if (new_password != confirm_password)
    {
        alert("新密码和确认密码不一致！");
        return false;
    }
    
    if (!confirm("确定继续？"))
    {
        return false;
    }
    
    var account_id = document.getElementById("account_id").value;
    var url = "rs/password/save.do";
    var content = "account.id=" + account_id
                + "&oldPassword=" + old_password
                + "&newPassword=" + new_password
                + "&confirmPassword=" + confirm_password;
    var objectid = "account_password";
    sendXMLHttpRequest(url, content, objectid); 
}
</script>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="5"></td>
    <td>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="5"></td>
      </tr>
      <tr>
        <td height="25" class="t1">
          <img src="images/small0.gif" width="14" height="12"> 您现在的位置&gt;&gt;修改密码</td>
      </tr>
    </table>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td colspan="6">
        <table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="images/table_top_left.jpg" width="20" height="15" /></td>
            <td><img src="images/table_top_bg.jpg" width="770" height="15"/></td>
            <td align="right">
              <img src="images/table_top_right.jpg" width="20" height="15" /></td>
          </tr>
        </table>
        </td>
      </tr>
     <tr>
      <td height="25" colspan="3" class="table_blue">
        <strong><img src="images/dot.jpg" width="13" height="9">修改密码</strong></td>
    </tr> 
    <tr>
      <td class="table_w1">&nbsp;<font color="red">(*)</font>账号：</td>
      <td class="table_w2" colspan="2">&nbsp;
        <input id="account_id" type="hidden" value="<s:property value="account.id" />" />
        <input id="account_name" type="text" size="60" value="<s:property value="account.name" />" readonly /></td>
    </tr>
    <s:if test="%{#session.account.id=='admin'}" >
        <input type="hidden" id="old_password" value="-" />
    </s:if>
    <s:else>
    <tr>
      <td class="table_w1">&nbsp;<font color="red">(*)</font>旧密码：</td>
      <td class="table_w2" colspan="2">&nbsp;
        <input id="old_password" type="password" size="60" value="" /></td>
    </tr>
    </s:else>
    <tr>
      <td class="table_w1">&nbsp;<font color="red">(*)</font>新密码：</td>
      <td class="table_w2" colspan="2">&nbsp;
        <input id="new_password" type="text" size="60"
          value="" />&nbsp;&nbsp;<button id="btn1" dojoType="dijit.form.Button"
            onclick="generate_passowrd('new_password');">随机密码</button></td>
    </tr>
    <tr>
      <td class="table_w1">&nbsp;<font color="red">(*)</font>密码确认：</td>
      <td class="table_w2" colspan="2">&nbsp;
        <input id="confirm_password" type="text" size="60" value="" /></td>
    </tr>
    <tr>
      <td colspan="3" class="table_w1" align="center">
        <button id="btn2" dojoType="dijit.form.Button"
            onclick="account_password_save();">保存</button>
      </td>      
    </tr>
      <tr> 
        <td colspan="6" background="images/table_bom_bg.jpg">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td>
              <img src="images/table_bom_left.jpg" width="20" height="15"></td>
            <td></td>
            <td align="right">
              <img src="images/table_bom_right.jpg" width="20" height="15"></td>
          </tr>
          </table>
        </td>
      </tr>
    </table>  
  </td>
  <td width="5"></td>
  </tr>
  </table>
  <div id="account_password"></div>